import { defineStore } from 'pinia'

export const useAuthStore = defineStore('auth', {
  state: () => ({
    userRole: '',
    isAuthenticated: false
  }),
  actions: {
    login(username) {
      this.isAuthenticated = true
      this.userRole = username === 'admin' ? 'admin' : 'user'
    },
    logout() {
      this.isAuthenticated = false
      this.userRole = ''
    }
  }
})